/*     */ package com.lmpop.trade.tb_returngoods;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.trade.ti_finance.Ti_financeInfo;
/*     */ import com.lmpop.trade.ti_finance_history.Ti_finance_historyInfo;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Tb_returngoodsInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Tb_returngoodsInfo()
/*     */   {
/*  25 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map) {
/*  29 */     String pkid_string = map.getString("pkid");
/*  30 */     String result_code = "0";
/*     */     try {
/*  32 */       if (!pkid_string.equals("")) {
/*  33 */         String[] pkStr = pkid_string.split("\\|");
/*  34 */         for (int i = 0; i < pkStr.length; i++) {
/*  35 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  39 */       result_code = "1";
/*     */     }
/*  41 */     map.setString("result_code", result_code);
/*  42 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid) throws ApplicationException {
/*  46 */     dbmMgr.update("deleteTb_returngoods", pkid);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj) {
/*  50 */     Tb_returngoods tb_returngoods = (Tb_returngoods)obj;
/*  51 */     List list = this.queryList.getList("getCountByObjTb_returngoods", obj);
/*  52 */     int count = 0;
/*  53 */     if ((list != null) && (list.size() > 0)) {
/*  54 */       Hashtable newsMap = (Hashtable)list.get(0);
/*  55 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/*  56 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/*  59 */     return count;
/*     */   }
/*     */ 
/*     */   public SysMap updateState(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  64 */     Tb_returngoods tb_returngoods = new Tb_returngoods();
/*  65 */     tb_returngoods.setOrder_no(map.getString("order_no"));
/*  66 */     tb_returngoods.setInfo_id(map.getString("return_id"));
/*  67 */     tb_returngoods.setPub_state(map.getString("pub_state"));
/*  68 */     tb_returngoods.setDeal_reason(map.getString("deal_reason"));
/*  69 */     tb_returngoods.setUser_id2(map.getString("user_id2"));
/*  70 */     String result_code = "0";
/*     */     try {
/*  72 */       updateState(dbmMgr, tb_returngoods);
/*     */     } catch (ApplicationException e) {
/*  74 */       e.printStackTrace();
/*  75 */       result_code = "1";
/*     */     }
/*     */ 
/*  78 */     List list = getListByPk(tb_returngoods.getInfo_id());
/*  79 */     Hashtable bmap = (Hashtable)list.get(0);
/*     */ 
/*  82 */     String return_state = map.getString("return_state");
/*  83 */     Ti_financeInfo ti_financeInfo = new Ti_financeInfo();
/*     */ 
/*  85 */     map.setString("use_vmoney", Integer.parseInt(bmap.get("totalmoney").toString()) + "");
/*  86 */     map.setString("cust_id", bmap.get("cust_id").toString());
/*  87 */     map.setString("finance_type", "1");
/*  88 */     map.setString("account_type", "1");
/*  89 */     ti_financeInfo.updateMoney(dbmMgr, map);
/*     */ 
/*  91 */     Ti_finance_historyInfo ti_finance_historyInfo = new Ti_finance_historyInfo();
/*  92 */     map.setString("trade_id)", map.getString("return_id"));
/*  93 */     map.setString("cust_id", bmap.get("cust_id").toString());
/*  94 */     map.setString("num", Integer.parseInt(bmap.get("totalmoney").toString()) + "");
/*  95 */     map.setString("type", "1");
/*  96 */     map.setString("reason", "订单" + map.getString("order_no") + "退货");
/*  97 */     map.setString("user_id", map.getString("user_id2"));
/*  98 */     map.setString("remark", "订单" + map.getString("order_no") + "退货");
/*  99 */     map.setString("vmoney", "0");
/* 100 */     map.setString("use_vmoney", "0");
/* 101 */     ti_finance_historyInfo.insert(dbmMgr, map);
/*     */ 
/* 104 */     Hashtable fmap = null;
/* 105 */     if ((return_state != null) && (return_state.equals("3"))) {
/*     */       try {
/* 107 */         List lt = this.queryList.getList("getTb_ordergoodsByPk", map.getString("order_no"));
/* 108 */         if ((lt != null) && (lt.size() > 0)) {
/* 109 */           fmap = (Hashtable)lt.get(0);
/* 110 */           dbmMgr.update("updateGoodsCur_storeByInfoId", fmap);
/*     */         }
/*     */       } catch (ApplicationException e) {
/* 113 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 116 */     map.setString("result_code", result_code);
/* 117 */     return map;
/*     */   }
/*     */ 
/*     */   public void updateState(DbmInterf dbmMgr, Tb_returngoods tb_returngoods) throws ApplicationException {
/* 121 */     dbmMgr.update("updateTb_returngoodsState", tb_returngoods);
/*     */   }
/*     */ 
/*     */   public int getCountReturnNoByState(String order_no)
/*     */   {
/* 129 */     List list = this.queryList.getList("getCountReturnNoByState", order_no);
/* 130 */     int count = 0;
/* 131 */     if ((list != null) && (list.size() > 0)) {
/* 132 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 133 */       if ((newsMap.get("countno") != null) && (!newsMap.get("countno").toString().equals(""))) {
/* 134 */         count = Integer.parseInt(newsMap.get("countno").toString());
/*     */       }
/*     */     }
/* 137 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit) {
/* 141 */     Tb_returngoods tb_returngoods = (Tb_returngoods)obj;
/* 142 */     if (start == 0)
/* 143 */       start = 0;
/*     */     else {
/* 145 */       start = (start - 1) * limit;
/*     */     }
/* 147 */     tb_returngoods.setStart(Integer.valueOf(start));
/* 148 */     tb_returngoods.setLimit(Integer.valueOf(limit));
/* 149 */     return this.queryList.getList("getListByTb_returngoodsPage", tb_returngoods);
/*     */   }
/*     */ 
/*     */   public List getListByPk(String id) {
/* 153 */     return this.queryList.getList("getTb_returngoodsByPk", id);
/*     */   }
/*     */ 
/*     */   public int getCountReturnNo(String order_no) {
/* 157 */     List list = this.queryList.getList("getCountReturnNo", order_no);
/* 158 */     int count = 0;
/* 159 */     if ((list != null) && (list.size() > 0)) {
/* 160 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 161 */       if ((newsMap.get("countno") != null) && (!newsMap.get("countno").toString().equals(""))) {
/* 162 */         count = Integer.parseInt(newsMap.get("countno").toString());
/*     */       }
/*     */     }
/* 165 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByGoodsId(String order_no) {
/* 169 */     return this.queryList.getList("getTb_returngoodsByOrder_no", order_no);
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map) {
/* 173 */     Tb_returngoods tb_returngoods = new Tb_returngoods();
/* 174 */     tb_returngoods.setInfo_id(map.getString("info_id"));
/* 175 */     tb_returngoods.setOrder_no(map.getString("order_no"));
/* 176 */     tb_returngoods.setOrder_state(map.getString("return_state"));
/* 177 */     tb_returngoods.setCust_id(map.getString("cust_id"));
/* 178 */     tb_returngoods.setGoods_id(map.getString("goods_id"));
/* 179 */     tb_returngoods.setGoods_name(map.getString("goods_name"));
/* 180 */     tb_returngoods.setTotalmoney(map.getString("totalmoney"));
/* 181 */     tb_returngoods.setReason(map.getString("reason"));
/* 182 */     tb_returngoods.setIn_date(map.getString("in_date"));
/* 183 */     tb_returngoods.setUser_id(map.getString("user_id"));
/* 184 */     tb_returngoods.setPub_state(map.getString("pub_state"));
/* 185 */     tb_returngoods.setDeal_reason(map.getString("deal_reason"));
/* 186 */     String result_code = "0";
/*     */     try {
/* 188 */       insert(dbmMgr, tb_returngoods);
/*     */     } catch (ApplicationException e) {
/* 190 */       e.printStackTrace();
/* 191 */       result_code = "1";
/*     */     }
/* 193 */     map.setString("result_code", result_code);
/* 194 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Tb_returngoods tb_returngoods) throws ApplicationException {
/* 198 */     dbmMgr.update("insertTb_returngoods", tb_returngoods);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map) {
/* 202 */     Tb_returngoods tb_returngoods = new Tb_returngoods();
/* 203 */     tb_returngoods.setInfo_id(map.getString("info_id"));
/* 204 */     tb_returngoods.setReason(map.getString("reason"));
/* 205 */     tb_returngoods.setOrder_state(map.getString("order_state"));
/* 206 */     String result_code = "0";
/*     */     try {
/* 208 */       update(dbmMgr, tb_returngoods);
/*     */     } catch (ApplicationException e) {
/* 210 */       e.printStackTrace();
/* 211 */       result_code = "1";
/*     */     }
/* 213 */     map.setString("result_code", result_code);
/* 214 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Tb_returngoods tb_returngoods) throws ApplicationException {
/* 218 */     dbmMgr.update("updateTb_returngoods", tb_returngoods);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.tb_returngoods.Tb_returngoodsInfo
 * JD-Core Version:    0.6.0
 */